package o;

import java.io.IOException;
import o.adr.a;
import o.adr.e;
import o.adr.j;

public final class agv extends adr {

    static final class b implements i {
        private final anc ˋ = new anc();
        private final int ˎ;
        private final anq ॱ;

        public b(int i, anq o_anq) {
            this.ˎ = i;
            this.ॱ = o_anq;
        }

        public j ˏ(adv o_adv, long j, a aVar) throws IOException, InterruptedException {
            long ˊ = o_adv.ˊ();
            int min = (int) Math.min(112800, o_adv.ॱ() - ˊ);
            this.ˋ.ˏ(min);
            o_adv.ˎ(this.ˋ.ˏ, 0, min);
            return ॱ(this.ˋ, j, ˊ);
        }

        private j ॱ(anc o_anc, long j, long j2) {
            int ॱ = o_anc.ॱ();
            long j3 = -1;
            long j4 = -1;
            long j5 = -9223372036854775807L;
            while (o_anc.ˊ() >= 188) {
                int ॱ2 = aha.ॱ(o_anc.ˏ, o_anc.ˋ(), ॱ);
                int i = ॱ2 + 188;
                if (i > ॱ) {
                    break;
                }
                j4 = aha.ˊ(o_anc, ॱ2, this.ˎ);
                if (j4 != -9223372036854775807L) {
                    j4 = this.ॱ.ˏ(j4);
                    if (j4 > j) {
                        if (j5 == -9223372036854775807L) {
                            return j.ˎ(j4, j2);
                        }
                        return j.ˏ(j2 + j3);
                    } else if (100000 + j4 > j) {
                        return j.ˏ(((long) ॱ2) + j2);
                    } else {
                        j3 = (long) ॱ2;
                        j5 = j4;
                    }
                }
                o_anc.ˋ(i);
                j4 = (long) i;
            }
            if (j5 != -9223372036854775807L) {
                return j.ˏ(j5, j4 + j2);
            }
            return j.ˋ;
        }

        public void ॱ() {
            this.ˋ.ˋ(anr.ʽ);
        }
    }

    public agv(anq o_anq, long j, long j2, int i) {
        super(new e(), new b(i, o_anq), j, 0, j + 1, 0, j2, 188, 940);
    }
}
